package com.tool_stdy.ConcurrencyModel.WorkMastser;

/**
 * Created by yan_li on 2016/11/11.
 */
public class Client {
    public static void main(String[] args) {
        Master master = new Master(new Worker(), 5);

        for (int i = 1; i <= 10; i++) {
            Task t = new Task();
            t.setId(i);
            master.submitTask(t);
        }
        master.execute();
        long start = System.currentTimeMillis();
        while(true){
            if(master.isComplete()){
                long end = System.currentTimeMillis() - start;
                int priceResult = master.getResult();
                System.out.println("最终结果：" + priceResult + ", 执行时间：" + end);
                break;
            }
        }
    }
}
